class Dog:
    def work(self): # ⽗类提供统⼀的⽅法，哪怕是空⽅法

        print('指哪打哪...')
class ArmyDog(Dog): # 继承Dog类
    def work(self): # ⼦类重写⽗类同名⽅法
        print('追击敌⼈...')
class DrugDog(Dog):
    def work(self):
        print('追查毒品...')
class Person:
    def work_with_dog(self, dog): # 传⼊不同的对象，执⾏不同的代码，即不同的work函数
        dog.work()


aa = ArmyDog()
dd = DrugDog()

xiaoming = Person()
xiaoming.work_with_dog(dd)